import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '事件类型',
    align:"center",
    dataIndex: 'dutyRemarkType_dictText'
   },
   {
    title: '开始时间',
    align:"center",
    dataIndex: 'dutyStartTime'
   },
   {
    title: '结束时间',
    align:"center",
    dataIndex: 'dutyEndTime'
   },
   {
    title: '调息人员',
    align:"center",
    dataIndex: 'dutyUserId_dictText'
   },
   {
    title: '说明',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "事件类型",
      field: 'dutyRemarkType',
      component: 'JSearchSelect',
      componentProps:{
         dict:"duty_remark_type"
      },
      //colProps: {span: 6},
 	},
	{
      label: "调息人员",
      field: 'dutyUserId',
      component: 'JSelectUser',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '事件类型',
    field: 'dutyRemarkType',
    component: 'JSearchSelect',
    componentProps:{
       dict:"duty_remark_type"
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入事件类型!'},
          ];
     },
  },
  {
    label: '开始时间',
    field: 'dutyStartTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm',
      format:'HH:mm',
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入开始时间!'},
          ];
     },
  },
  {
    label: '结束时间',
    field: 'dutyEndTime',
    component: 'TimePicker',
    componentProps: {
      valueFormat: 'HH:mm',
      format:'HH:mm',
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入结束时间!'},
          ];
     },
  },
  {
    label: '调息人员',
    field: 'dutyUserId',
    component: 'JSelectUser',
    componentProps:{
        labelKey:'realname',
     },
  },
  {
    label: '说明',
    field: 'remark',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
  {
	  label: '',
	  field: 'dutyPersonId',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  dutyRemarkType: {title: '事件类型',order: 0,view: 'sel_search', type: 'string',dictCode: 'duty_remark_type',},
  dutyStartTime: {title: '开始时间',order: 1,view: 'time', type: 'string',},
  dutyEndTime: {title: '结束时间',order: 2,view: 'time', type: 'string',},
  dutyUserId: {title: '调息人员',order: 3,view: 'sel_user', type: 'string',},
  remark: {title: '说明',order: 4,view: 'textarea', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}